package com.zhangfei.function;

import java.util.function.Function;

public class FunctionTest {
    private static Integer function(String something, Function<String, Integer> function) {
        return function.apply(something);
    }

    private static Integer andFunction(String something, Function<String, Integer> function1, Function<Integer, Integer> function2) {
        return function1.andThen(function2).apply(something);
    }


    public static void main(String[] args) {
        //lambda
        int i = function("1000", (String something) -> {
            return Integer.parseInt(something);
        });

        System.out.println("lambda表达式function转换：" + i);


        //lambda
        int j = andFunction("1000", something -> Integer.parseInt(something), something -> something % 10);

        System.out.println("lambda表达式functionAnd转换：" + j);
    }
}
